package by.dvrudenko.avtobaza.dataaccess;

import java.sql.Timestamp;
import java.util.List;

import javax.persistence.metamodel.SingularAttribute;

import by.dvrudenko.avtobaza.dataaccess.en.Restriction;

public interface AbstractDao<ID, Entity> {

	Entity getById(ID id);

	List<Entity> getAll();

	void delete(ID key);

	void deleteAll();

	void delete(List<ID> ids);
	
	// все значения равные переданному
	List<Entity> getAllByFieldRestriction(final SingularAttribute<? super Entity, ?> attribute, final Object value);
	
	List<Entity> getAllByFieldGreaterOrLessThan(final SingularAttribute<? super Entity, Integer> attribute, 
			final Integer value, Restriction condition);
	
	List<Entity> getAllByFieldByDate(final SingularAttribute<? super Entity, Timestamp> attribute, 
			final Timestamp value, Restriction condition);
	
	Entity insert(Entity entity);

	Entity update(Entity entity);
	
	Entity randomEntity();
	
	

	
	//void changeBooleanParam(final SingularAttribute<? super Entity, Boolean> attribute,ID id, final Boolean value);

}
